﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ECommerce.WebControls
{
    public partial class WebObjetoViewList : System.Web.UI.WebControls.WebControl
    {
        private int identity;
        public int Identity
        {
            get { return this.identity; }
            set { this.identity = value; }
        }
        private bool showIdentity;
        public bool ShowIdentity
        {
            get { return this.showIdentity; }
            set { this.showIdentity = value; }
        }
        public System.Web.UI.WebControls.CheckBox chkSelected;
        public System.Web.UI.WebControls.HyperLink lnkId;
        public System.Web.UI.WebControls.HyperLink lnkDenominación;
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            if (chkSelected == null)
                chkSelected = new System.Web.UI.WebControls.CheckBox();
            if (lnkId == null)
                lnkId = new System.Web.UI.WebControls.HyperLink();
            if (lnkDenominación == null)
                lnkDenominación = new System.Web.UI.WebControls.HyperLink();
            chkSelected.SkinID = "CheckBoxSelected";
            lnkId.SkinID = "CamposId";
            lnkDenominación.SkinID = "CamposDenominación";
        }
        public virtual void Cargar()
        {
            ECommerce.Model.Objeto Objeto = new ECommerce.Model.Objeto();
            if (this.Identity != 0)
            {
                Objeto = ECommerce.DAO.SQL.Objeto.GetObjetoById(this.Identity);
            }
            ECommerce.Factory.WebControls.WebObjeto.Load(this, Objeto);
        }
        public virtual void Cargar(ECommerce.Model.Objeto Objeto)
        {
            ECommerce.Factory.WebControls.WebObjeto.Load(this, Objeto);
        }
        public virtual void Guardar()
        {
            ECommerce.Model.Objeto Objeto = new ECommerce.Model.Objeto();
            ECommerce.Factory.Objeto.Load(Objeto, this);
            Objeto.Save();
        }
        public virtual void Guardar(ECommerce.Model.Objeto Objeto)
        {
            ECommerce.Factory.Objeto.Load(Objeto, this);
            Objeto.Save();
        }

        public void Borrar(ECommerce.Model.Objeto Objeto)
        {
            Objeto.Del();
        }
    }
}
